<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.SmsModule.bean.*,com.SmsModule.dao.*,com.UserModule.dao.*"%>  
<%@ page import="util.*" %>
<%
	String startTime = session.getAttribute("startTime").toString();
	String endTime = session.getAttribute("endTime").toString();
	String content=session.getAttribute("content").toString();
	String shenhestatus=session.getAttribute("phone").toString();
	List<TbSmsSendContent> SmsContentList = (ArrayList) session.getAttribute("SmsContentList");
	  //---------分页
	    int currentPage=1;
	    if(request.getParameter("Page")!=null)
	    {
	    	currentPage=Integer.parseInt(request.getParameter("Page"));
	    }
	//System.out.println("size==" + SmsContentList.size());
%>

<jsp:include page="../head.jsp"></jsp:include>
<body>
<div id="pager">
<jsp:include page="../top.jsp"><jsp:param name="topCurrent" value="1" /></jsp:include>    
<jsp:include page="leftSms.jsp">
<jsp:param name="smsSendStyle" value="12" /></jsp:include> 
		<section id="container">
        <div id="crumbs">
        	短信管理 &raquo; 短信审核列表
        </div>
    <div id="main">
			<div class="tabs">
				<ul class="tabs-nav clearfix">
					<li>
						 短信审核列表
					</li>
				</ul>
				<div class="tabs-panel">
				<%
			try{
		 	 String resultSM=session.getAttribute("resultSM").toString();
			 if(!resultSM.equals("")){
				 out.println("<script>alertmess('"+resultSM+"');</script>");
				 session.removeAttribute("resultSM");
			 }
			 }catch(Exception ex){
			 
			 }
		 	%>
				 <form action="" method="post" id="form1" name="form2">
					<table width="100%" class="datalist">
						<thead>
							<tr>
								<th colspan="9" class="tl">
												开始时间
												 <input type="text" id="startTime" name="startTime" size="25" class="Wdate" value="<%=startTime %>" readonly onclick="WdatePicker({el:'startTime',dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
												结束时间
												<input type="text" id="endTime" name="endTime" class="Wdate" size="25"  value="<%=endTime%>"  readonly onclick="WdatePicker({el:'endTime',dateFmt:'yyyy-MM-dd HH:mm:ss'})" />
												短信内容
												<input type="text" id="content" name="content" value="<%=content %>" />
												审核状态
												<select id="phone" name="phone">
													<option value="-2">请选择...</option>
													<option value="0" 
													<%
													 if("0".equals(shenhestatus)){
													 %>
													 selected="selected"
													<%
													 }
													 %>
													>未审核</option>
													<option value="1" <%
													 if("1".equals(shenhestatus)){
													 %>
													 selected="selected"
													<%
													 }
													 %>>审核通过</option>
													<option value="2" <%
													 if("2".equals(shenhestatus)){
													 %>
													 selected="selected"
													<%
													 }
													 %>>审核不通过</option>
												</select>
												 
												<input type="button" value="查询" onclick="searcherSM('../TbSmsServlet?method=look&looksms=0')" />&nbsp;&nbsp;
												<input type="button" value="批删" onclick="deleteSmsAllSM('deleteAll','../TbSmsServlet?method=deleteAll&looksms=0&startTime=<%=startTime%>&endTime=<%=endTime%>&content=<%=content %>&phone=<%=shenhestatus %>')" />
								</th>
							</tr>
							<tr>
								<td class="tc">
									<input type="checkbox" title="全选" onClick="check_allSM('deleteAll')"/>
								</td>
								<td>
									序号
								</td>
								<td>
									短信内容
								</td>
								<td>
									发送时间
								</td>
								<td>
									发送人
								</td>
								<td>
									短信类型
								</td>
								<td>
									审核状态
								</td>
								<td>
									审核
								</td>
								<td>
									删除
								</td>
							</tr>
						</thead>
						<%
						if(SmsContentList!=null){
							int i=0;  
											//--------------分页
								    					MyPagination mPage=new MyPagination();
								     					SmsContentList=mPage.getInitPage(SmsContentList,currentPage,10);
											if (SmsContentList != null && SmsContentList.size() > 0) {
											
												for (TbSmsSendContent smsSendContentBean : SmsContentList) {
												i++;
						%>
						<tr>
							<td class="tc">
								<input name="deleteAll" id = "deleteAll" type="checkbox" value="<%=smsSendContentBean.getSmsSendContentId() %>"/>
							</td>
							<script type="text/javascript">
							$(function(){
				 				$('#demo-basic<%=i%>').poshytip();
							
				   			})
				  			 </script>
				  			 <td><%=((10*(currentPage-1))+i) %></td>
							<td><a id="demo-basic<%=i%>" title="<%=smsSendContentBean.getSmsSendContent()%>" href="#"><%=new UtilDAO().sub_String(smsSendContentBean.getSmsSendContent())%></a></td>
							<td><%=smsSendContentBean.getCreateTime().substring(0,19)%></td>
							<td><%=(new TbUserDAO().getTbUsersByUserId(smsSendContentBean.getUserId())).getUserName()%></td>
							<td><%=(new TbSendTypeDAO().getTbSendTypeByTypeId(smsSendContentBean.getTypeId())).getTypeName()%></td>
							<td>
								<%
								if(smsSendContentBean.getReviewState()==0){
								%>
								未审核
								<%
								}else if(smsSendContentBean.getReviewState()==1){
								%>
								审核成功
								<%
								
								}else if(smsSendContentBean.getReviewState()==2)
								{
								%>
								审核失败
								<%
								}
								 %>
							</td>
							<td class="tc">
							    <%
							    if(smsSendContentBean.getReviewState()==0){
							    %>
							     <a title="审核通过" class="duanyu_edit" style="cursor:hand"  onClick="shenheSM('../TbSmsServlet?method=shenhe&isshenhe=1&looksms=0&smsId=<%=smsSendContentBean.getSmsSendContentId() %>')">审核通过</a>
								 <a title="审核不通过" class="duanyu_edit" style="cursor:hand"  onClick="shenheSM('../TbSmsServlet?method=shenhe&isshenhe=2&looksms=0&smsId=<%=smsSendContentBean.getSmsSendContentId() %>')">审核不通过</a>
							    <%
							    }else{
							    %>
							    已经过审核
							    <%}
							     %>
							   
								
							</td>
							<td>
							<a title="删除该短信" class="duanyu_del" style="cursor:hand" onClick="deleteOneSM('../TbSmsServlet?method=deleteOne&looksms=0&smsId=<%=smsSendContentBean.getSmsSendContentId() %>')">删除</a>
							</td>
						</tr> 
						<%
							}
							}
							%>
							<%=mPage.printCtrl("SmsModule/SmsContentList.jsp",currentPage,"&startTime="+startTime+"&endTime="+endTime+"&content="+content) %>
							<%
							}
						%>
						
					</table>
					
				</form>
				</div>
		</div>
		</section>
		  <jsp:include page="../foot.jsp"></jsp:include>
	</body>
</html>
